Skip to content

Conversation

@HertzDevil
Copy link
Contributor

Follow-up to #15667.

LARGE_POWER_OF_5 = Slice[
1414648277510068013_u64, 9180637584431281687_u64, 4539964771860779200_u64,
10482974169319127550_u64, 198276706040285095_u64,
{% if compare_versions(Crystal::VERSION, "1.16.0") < 0 %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: The value lists are identical between both types. We could reduce code duplication by making only the outer layer conditional:

{% begin %}
  {% if compare_versions(Crystal::VERSION, "1.16.0") < 0 %}
    [
  {% else %}
    Slice(UInt64).literal(
  {% end %}
  1_u64,
  # ...
  7450580596923828125_u64,
  {% if compare_versions(Crystal::VERSION, "1.16.0") < 0 %}
    ]
  {% else %}
    )
  {% end %}
{% end %}

The added overhead won't make this much appealing for very short slices. But it might be a good idea for the bigger ones? WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants